using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Configuration;

namespace TestData
{
    internal static class Program
    {
        [STAThread]
        private static void Main(string[] args)
        {
            ///celeriq /connectionstring:"Data Source=.\SQL2014;Initial Catalog=Autos;Integrated Security=SSPI"
            if (args.Contains("/celeriq"))
            {
                //var cs = args.ToList().FirstOrDefault(x => x.StartsWith("/connectionstring:")) + string.Empty;
                //var index = cs.IndexOf(":");
                //if (index == -1)
                //{
                //    Console.WriteLine("Connection string not set.");
                //    return;
                //}
                //var connectionString = cs.Substring(index + 1, cs.Length - index - 1);
                var connectionString = ConfigurationManager.ConnectionStrings["AutosEntities"].ConnectionString;
                Populate.LoadRepository(connectionString);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }
    }
}